﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.IO;
using System.Globalization;
using System.Windows.Forms;

namespace CommunicationBuddy
{
    class PluginLog
    {

        private static string path = Application.StartupPath+@"\Plugins\CommunicationBuddy\Logs\Log.txt";
        public static void newEntry()
        {

            DateTime dt = DateTime.Now;
            Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
            using (StreamWriter writer = new StreamWriter(path, true))
            {
                writer.WriteLine("@ LOGGED DATE " + dt.ToString("dd/MM-yy"));
            }
        }


        public static void writeLine(string input)
        {

            DateTime dt = DateTime.Now;
            Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
            using (StreamWriter writer = new StreamWriter(path, true))
            {
                writer.WriteLine("[" + dt.ToString("hh:mm:ss") + "]" + " " + input);
            }
        }


        public static void clearLog()
        {
            using (StreamWriter writer = new StreamWriter(path,false))
            {
                writer.Write("");
            }
            
        }
    }
}
